home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 306 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  54 lines

  1. Path: ohstpy.mps.ohio-state.edu!vancleef
  2. From: vancleef@ohstpy.mps.ohio-state.edu
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HP UX 10.0 C programming
  5. Message-ID: <1996Jan4.021743.8654@ohstpy>
  6. Date: 4 Jan 96 02:17:43 -0500
  7. References: <4cfje3$qk@nn.fast.net>
  8. Organization: The Ohio State University, Department of Physics
  9.  
  10. In article <4cfje3$qk@nn.fast.net>, "Chad R. Laity" <wick@pop.fast.net> writes:
  11. > 2 questions: (1) What is a good book for HP UX 10.0 C programming?
  12. >              (2) Why do I get an error on this cut down program listed
  13. >                  below when I compile it on an HP 9000 K200 with HP UX 10.0
  14. >                  and I do not get an error with our Intergraph server?
  15. >                  (basically I just want to get the file size of a file but
  16. >                   this buf problem is giving me a head ache)
  17. > ----------------------- program ---------------------------------
  18. > #include <stdio.h>
  19. > #include <sys/stat.h>
  20. > main()
  21. > {
  22. > int i;
  23. > int stat(const char *path, struct stat *buf);    
  24. > i = stat("/usr2/test/testfile", &buf);           /* line 15 */
  25. > }
  26. > ------------------------ error -----------------------------------
  27. > Compiled using: cc -Aa test.c
  28. > cc: "test.c", line 15: error 1588: "buf" undefined.
  29. > cc: "test.c", line 15: warning 563: Argument #2 is not the correct type.
  30.  
  31. Prototypes don't do inside functions. Also it would help
  32. if you defined what buf was:
  33.  
  34. int stat(const char *path, struct stat *buf);
  35.  
  36. main()
  37. {
  38.    struct stat buf;
  39.  
  40. ...
  41.  
  42. }
  43.  
  44. -Garrett
  45.  
  46.  
  47.